package model;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "VOYAGE_AVION")
public class VoyageAvion {
	private int id;
	private VilleAvion villeDepart;
	private String dateVol;
	private String heureVol;
	private List<HoraireAvion> horairesavion;

	public VoyageAvion() {
	}

	public VoyageAvion(VilleAvion villeDepart, String dateVol) {
		this.villeDepart = villeDepart;
		this.dateVol = dateVol;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "VOYAGE_AVION_ID")
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name = "VILLE_DEPART")
	public VilleAvion getVilleDepart() {
		return villeDepart;
	}

	public void setVilleDepart(VilleAvion villeDepart) {
		this.villeDepart = villeDepart;
	}

	public String getDateVol() {
		return dateVol;
	}

	public void setDateVol(String dateVol) {
		this.dateVol = dateVol;
	}

	public String getHeureVol() {
		return heureVol;
	}

	public void setHeureVol(String heureVol) {
		this.heureVol = heureVol;
	}

	@OneToMany(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER, mappedBy = "voyageAvion")
	public List<HoraireAvion> getHorairesavion() {
		return horairesavion;
	}

	public void setHorairesavion(List<HoraireAvion> horairesavion) {
		this.horairesavion = horairesavion;
	}

}
